Ajax = function()
{
	var XMLHTTP = createXMLHTTP();
	var resultHandle = null;

	this.getXMLHTTP = function()
	{
		return XMLHTTP;
	}

	function createXMLHTTP() 
	{
		var ajax_object = false;
		if(window.XMLHttpRequest)
		{
			ajax_object = new XMLHttpRequest();
			if(ajax_object.overrideMimeType) 
			{
				ajax_object.overrideMimeType('text/xml');
			}
		} 
		else if(window.ActiveXObject) 
		{
			var versions = ['Microsoft.XMLHTTP', 'MSXML.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.7.0', 'Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP'];
			for(var i=0; i<versions.length; i++) 
			{
				try 
				{
					ajax_object = new ActiveXObject(versions[i]);
					if(ajax_object) 
					{
						return ajax_object;
					}
				} 
				catch(e) 
				{
					alert(e.message);
				}
			}
		}
		return ajax_object;
	}

	this.get = function(targetUrl, Handle) 
	{
		XMLHTTP.onreadystatechange = this.processHandle;
		resultHandle = Handle;
		XMLHTTP.open('GET', targetUrl, true);
		XMLHTTP.send(null);
	}		

	this.post = function(targetUrl, sendString, Handle) 
	{
		XMLHTTP.onreadystatechange = this.processHandle;
		resultHandle = Handle;
		XMLHTTP.open('POST', targetUrl);
		XMLHTTP.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		XMLHTTP.send(sendString);
	}
	
	this.processHandle = function()
	{	
		if(XMLHTTP.readyState == 4) 
		{
			if(XMLHTTP.status == 200) 
			{
				var return_data = resultHandle(XMLHTTP.responseText, this);
			}
		}
	}
}
